

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/reset.css">
    <link rel="stylesheet" type="text/css" href="css/layer.css">
    <link rel="stylesheet" type="text/css" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <script src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
    <script src="js/layer.js"></script>
    <script src="js/swiper.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
</head>
<body>
  	<div class="nav"></div>
	<div class="film-list top125">
		<div class="list">
            <div class="list-type clearfix">
              <div class="list-title">已购买电影</div>
            </div>
	        <ul>
	          
	        </ul>
            <div class="click-more">点击加载更多</div>
        </div>
	</div>
  </div>
  <div class="search-box searchide"></div>
</body>
<script type="text/javascript">
    $(function(){
        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return (r[2]);
            return null;
        }
        var id = getQueryString('id');
        var uid = $.cookie('id');
        var token = $.cookie('token_access');
        var pageNum =1;
        var pageSize = 15;
        movieListSee(id,pageNum,pageSize)
        function movieListSee(id,pageNum,pageSize){
            if(id == 'purchasedList'){
                $(".list .list-title").html("已购买电影")
            }else{
                $(".list .list-title").html("观看历史")
            }
            $.ajax({
                url: window.baseUrl+'api/movie/'+id,
                type: 'get',
                data: {
                    pageNum:pageNum,
                    pageSize:pageSize,
                },
                beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", token);
                },
                success: function (data) {
                    var details_tj = '';
                    var result = data.datas.result;
                    if(pageNum <= data.datas.pages){
                        if(result.length == 15){
                            $(".click-more").show()
                        }else{
                            $(".click-more").hide()
                        }
                        for(var i = 0;i<result.length;i++){
                            if(result[i].tag == ''){
                                  var setTag = ''
                              }else{
                                  var setTag = '<div class="hot"><span>'+result[i].tag+'</span></div>'
                              }
                            details_tj = details_tj+'<li><div class="piclist-img">'+
                            '<a href="detail.html?id='+result[i].id+'" >'+
                            '<img src="'+result[i].logo+'" alt="">'+
                            '<div class="definition">'+result[i].clarity+'</div>'+setTag+
                            ' </a></div><div class="piclist-title">'+result[i].movieName+'</div></li></div>';
                        }
                        $(".film-list .list ul").append(details_tj)
                    }else{
                        $(".click-more").hide()
                    }
                }
            });
        }
        $(".click-more").on("click",function(){
            pageNum = pageNum+1;
            console.log(pageNum)
            movieListSee(id,pageNum,pageSize)
        })
    })
</script>
</html>